package com.rq.demo.controller;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.rq.base.ui.BaseController;
import com.rq.base.ui.impl.OnClick;
import com.rq.base.util.LOG;
import com.rq.base.util.PopUtil;
import com.rq.base.util.StringUtil;
import com.rq.base.util.WriteUtil;
import com.rq.demo.R;

import java.util.Date;

import ecomm.lib_comm.permission.PermissionUtil;

/**
 * Created by RaoQian on 2022/9/19.
 */
public class TestController extends BaseController implements View.OnClickListener {
    @Override
    public int getLayoutId() {
        return R.layout.act_test;
    }

    @Override
    public void onViewCreated(Bundle savedInstanceState) {
        super.onViewCreated(savedInstanceState);
        setData2View(R.id.id_3, "这是填充内容");
    }

    @OnClick({R.id.id_2, R.id.id_1, R.id.btn})
    public void onClick(View v) {
        if (v.getId() == R.id.btn) {
            PopUtil.showTimeAll(getActivity(), v, (clickFrom, date) -> LOG.e("TestController", "38:" + StringUtil.getTimeShowStr(date.getTime())));
        } else if (v.getId() == R.id.id_2) {
            LOG.e("TestController", "30:" + WriteUtil.getInstance().hasWritePermission());
        } else if (v.getId() == R.id.id_1) {
            PermissionUtil.selectLocalFile(getActivity(), new PermissionUtil.OnPermissionListener() {
                @Override
                public void onPermissionOk() {

                }
            });
        }
    }

}
